﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LeMigue.Scrum.Iterface.Enum;

namespace LeMigue.Scrum.TfsScrumV1.Utils
{
    public class WorkItemState
    {
        public static readonly WorkItemState InProgress = new WorkItemState("In Progress", TaskState.InProgress);
        public static readonly WorkItemState ToDo = new WorkItemState("To Do", TaskState.ToDo);
        public static readonly WorkItemState Done = new WorkItemState("Done", TaskState.Done);
        public static readonly WorkItemState Removed = new WorkItemState("Removed", TaskState.Removed);

        private static IDictionary<string, WorkItemState> _listStates;

        static WorkItemState() { }

        private string _status;
        private TaskState _scrumState;

        private WorkItemState(string status, TaskState scrumState)
        {
            _status = status;
            _scrumState = scrumState;

            if(WorkItemState._listStates == null)
                WorkItemState._listStates = new Dictionary<string, WorkItemState>();

            WorkItemState._listStates.Add(status, this);
        }

        public override string ToString()
        {
            return _status;
        }

        public TaskState ScrumState
        {
            get
            {
                return _scrumState;
            }
        }

        public static WorkItemState StateByWorkItemState(string status)
        {
            return _listStates[status];
        }
    }
}
